<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/common/taglibs.jsp"%>
<%--@elvariable id="handler" type="com.youtills.core.app.calc.LoanCalcRequestHandler"--%>
<div id="loan">
    <h2>Loan Payment Calculator</h2>
    <form action="${pageContext.request.contextPath}/loan-calc" method="post">
        <div id="loan-input" style="display: table;">
            <table>
                <tr><td align="right"><label for="principal">Principal: </label></td><td><input id="principal" step="any" type="number" name="principal" value="${handler.principal}"/></td></tr>
                <tr><td align="right"><label for="rate">Rate: </label></td><td><input type="number" step="any" name="rate" id="rate" value="${handler.rate}"/></td></tr>
                <tr><td align="right"><label for="term">Term: </label></td><td><input type="number" name="term" id="term" value="${handler.term}"/></td></tr>
            <tr><td align="center" colspan="2"><input type="submit" name="action" value="Calculate"/></td></tr>
            </table>
            </div>
        <c:if test="${handler.loan != null}">
            <div>Payment : <fmt:formatNumber pattern="#.##" value="${handler.loan.payment}" /></div>
        </c:if>
    </form>
</div>